var app = getApp();
var Util = require('../../utils/util.js')
var Json= require('../../json.js')
Page({
  /**
   * 页面的初始数据
   */
 
  data: {
   parameter:{
      'title': '申请保修',
      'navbar': '1'
    },
    images:[]
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
  
  },
  chooseImage:function(e) {
    var index = e.currentTarget.dataset['index'];
    if(!index){
      index = this.data.images.length;
    }
    var that = this;
    wx.chooseImage({
      count: 2,
      sizeType: ['original', 'compressed'],
      sourceType: ['album', 'camera'],
      success: res => {
        const image = res.tempFilePaths;
        var dimages = that.data.images;

        dimages[index] = image;
        dimages = dimages.length <= 2 ? dimages : dimages.slice(1, 3);
        that.setData({
          images: dimages
        })
      }
    })},
  gotoSelecteType: function () {
    wx.navigateTo({
      url: '/pages/repair-select/index'
    })
  },
  catchTouchMove: function (res) {
    return false
  },
  onColse:function(){

  },
 
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

    var that = this
  
    //模拟数据
    that.setData({
      user: Json.default.userIn
    })
  }, formSubmit: function (e) {
    app.Tips({ title: '提交成功', icon: 'success' },'/pages/repair-receive/index');
  }
})